package com.sanploy.manage.controller;

import com.sanploy.common.domain.SystemConfig;
import com.sanploy.manage.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *  Created by zhu yingzhi on 2017/10/17.
 *  @author yingzhi zhu
 *  系统配置请求路由 暂时没用
 */
@RestController
@RequestMapping("/sys_config")
public class SysConfigController {
    @Autowired
    private SysConfigService sysConfigService;
    /**
     * 获得所有的系统配置项
     * @return
     */
    @GetMapping("")
    public Object getAllConfig(){
        return sysConfigService.getAll();
    }

    /**
     * 编辑配置项
     * @param systemConfig
     * @return
     */
    @PostMapping("/{id}")
    public Object editConfigById(SystemConfig systemConfig){
        return sysConfigService.editConfig(systemConfig);
    }

    /**
     * 获取某个配置项的值
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public Object getConfigById(@PathVariable Long id){
        return sysConfigService.getConfigById(id);
    }
}
